Skip to content

Conversation

@i-am-logger
Copy link
Contributor

@i-am-logger i-am-logger commented Oct 2, 2025

Summary

Adds complete hardware configuration for Lenovo Legion Pro 7 16IRX8H, enabling audio that was previously non-functional.

Changes

Audio Configuration:

  • Add Realtek ALC287 + TAS2781 I2C codec support with proper kernel parameters
  • Set snd_hda_intel.model=legion-y7000 for correct speaker routing
  • Enable snd_soc_tas2781.reset_calib=1 to handle corrupted factory calibration (known Legion issue)
  • Configure modprobe options for Legion-specific audio model

Bluetooth:

  • Enable Bluetooth LE Audio support via BlueZ experimental features
  • Set powerOnBoot = false to save battery
  • Configure dual mode and fast connectable for optimal performance

Thermal Management:

  • Enable thermald for active cooling management
  • Add ACPI workarounds for Legion BIOS issues (acpi.debug_layer, processor.ignore_ppc)
  • Add tsc=reliable to fix TSC ADJUST firmware bugs

Other:

  • Add audio group permissions
  • Enable redistributable firmware for audio codecs

Testing

Tested on Legion Pro 7 16IRX8H (Raptor Lake):

  • ✅ Audio working (internal speakers, headphones)
  • ✅ TAS2781 codec binds correctly
  • ✅ Bluetooth functional with LE Audio
  • ✅ Thermal zones reporting correctly (12 zones active)
  • ✅ No boot errors or warnings

Notes

The snd_hda_intel.model=legion-y7000 parameter is temporary until proper kernel quirks are upstreamed to the ALSA HDA driver.

@i-am-logger i-am-logger marked this pull request as draft October 3, 2025 01:25
@i-am-logger
Copy link
Contributor Author

i got the speakers working but doing some more fixes so will improve this PR in the coming days

@i-am-logger i-am-logger force-pushed the lenovo-legion-16irx8h-audio-fix branch from df55ad1 to 161f691 Compare October 3, 2025 04:55
@i-am-logger i-am-logger changed the title lenovo/legion/16irx8h: fix audio for Realtek ALC287 codec lenovo/legion/16irx8h: fix audio and clean up kernel parameters Oct 3, 2025
@i-am-logger i-am-logger marked this pull request as ready for review October 3, 2025 04:56
@i-am-logger i-am-logger force-pushed the lenovo-legion-16irx8h-audio-fix branch from 161f691 to 4972097 Compare October 3, 2025 05:04
@i-am-logger i-am-logger changed the title lenovo/legion/16irx8h: fix audio and clean up kernel parameters lenovo/legion/16irx8h: add comprehensive audio and hardware support Oct 3, 2025
@i-am-logger i-am-logger force-pushed the lenovo-legion-16irx8h-audio-fix branch from 4972097 to a1afc79 Compare October 3, 2025 05:07
@i-am-logger
Copy link
Contributor Author

PR is ready

@i-am-logger i-am-logger force-pushed the lenovo-legion-16irx8h-audio-fix branch from a1afc79 to ed56a01 Compare October 4, 2025 20:08
@i-am-logger
Copy link
Contributor Author

wierd, sound just stopped working, putting back to draft

@i-am-logger i-am-logger marked this pull request as draft October 4, 2025 20:12
Add full hardware configuration for Legion Pro 7 16IRX8H including:
- Realtek ALC287 + TAS2781 audio with proper kernel params
- Bluetooth LE Audio support via BlueZ settings
- Thermal management (thermald + ACPI fixes)
- Audio group permissions

Fixes audio issues where speakers wouldn't work due to missing
TAS2781 calibration reset and incorrect HDA model detection.
@i-am-logger i-am-logger force-pushed the lenovo-legion-16irx8h-audio-fix branch from ed56a01 to 4771157 Compare October 4, 2025 21:57
@i-am-logger i-am-logger marked this pull request as ready for review October 4, 2025 22:23
@i-am-logger
Copy link
Contributor Author

had a few restarts and seems stable now

Copilot AI review requested due to automatic review settings December 20, 2025 20:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive hardware support for the Lenovo Legion Pro 7 16IRX8H laptop, with a primary focus on enabling audio functionality that was previously non-functional. The changes configure the Realtek ALC287 and TAS2781 I2C audio codecs, enable Bluetooth with LE Audio support, add thermal management, and include various ACPI workarounds for Legion BIOS issues.

Key changes:

  • Audio configuration with kernel parameters and modprobe options for ALC287 + TAS2781 codecs, including calibration reset workarounds
  • Bluetooth configuration with LE Audio and battery-saving options
  • Thermal management via thermald and ACPI workarounds for BIOS compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +91 to +93
# Audio group permissions
users.groups.audio = { };

Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating an empty audio group without assigning any users to it serves no purpose. In NixOS, audio permissions are typically managed through PulseAudio/PipeWire access control or by adding users to the audio group via users.users.<name>.extraGroups. Simply defining an empty group doesn't grant any permissions. Either remove this line or document why an empty audio group is needed for this hardware.

Suggested change
# Audio group permissions
users.groups.audio = { };

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +41
# ACPI thermal management fixes for Legion BIOS issues
"acpi.debug_layer=0x2"
"acpi.debug_level=0x2"
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ACPI debug parameters (acpi.debug_layer=0x2 and acpi.debug_level=0x2) enable ACPI debug output to the kernel log. While the comment states these are "fixes for Legion BIOS issues," debug flags typically just increase logging verbosity rather than fixing functional problems. These can impact boot performance and fill logs with debug messages. Unless there's documented evidence that these debug flags actually resolve a specific BIOS issue, consider removing them or clarifying what specific problem they address.

Suggested change
# ACPI thermal management fixes for Legion BIOS issues
"acpi.debug_layer=0x2"
"acpi.debug_level=0x2"
# ACPI thermal/power management quirk workaround for Legion BIOS issues

Copilot uses AI. Check for mistakes.
# Audio configuration
"snd_hda_intel.enable_msi=1"
# Legion-specific audio model (required until kernel quirk is upstreamed)
"snd_hda_intel.model=lenovo-legion-7i"
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states that the parameter should be snd_hda_intel.model=legion-y7000, but the actual implementation uses lenovo-legion-7i. These values need to match. Please verify which model string is correct for the Legion Pro 7 16IRX8H and ensure consistency between the description and implementation.

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +48
"snd_hda_intel.model=lenovo-legion-7i"
# TAS2781 calibration reset to handle CRC errors in factory calibration data
# This is a known issue on Legion laptops where the TAS2781 firmware has corrupted
# calibration values; resetting allows the codec to initialize with defaults
"snd_soc_tas2781.reset_calib=1"
# More aggressive TAS2781 fixes for Legion
"snd_soc_tas2781.tas2781_dev_id=0x6a"
"snd_hda_intel.single_cmd=1"
# Hardware fixes
"tsc=reliable" # Fix TSC ADJUST firmware bugs common on Legion laptops
# ACPI thermal management fixes for Legion BIOS issues
"acpi.debug_layer=0x2"
"acpi.debug_level=0x2"
"processor.ignore_ppc=1"
];

# Additional audio configuration for Legion Pro 7
boot.extraModprobeConfig = ''
# Force specific Legion audio model for proper speaker routing
options snd-hda-intel model=lenovo-legion-7i single_cmd=1 probe_mask=1
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The audio model configuration is duplicated in both boot.kernelParams (line 29) and boot.extraModprobeConfig (line 48). While having both kernel command line and modprobe options can sometimes be necessary, the duplication here also includes the single_cmd parameter which is set in both places. Consider removing the redundant model specification from one location to avoid potential conflicts and reduce maintenance burden. Typically, modprobe configuration in extraModprobeConfig is sufficient for module-specific options.

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +62
# Enable Bluetooth modules
boot.kernelModules = [
"bluetooth"
"btusb"
];

Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually loading bluetooth and btusb kernel modules is typically unnecessary as they are auto-loaded by udev when Bluetooth hardware is detected. This explicit loading adds no value since hardware.bluetooth.enable already handles module loading appropriately. Consider removing this configuration unless there's a specific hardware detection issue that requires it.

Suggested change
# Enable Bluetooth modules
boot.kernelModules = [
"bluetooth"
"btusb"
];

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant